﻿using DotNetExtensions.Core.IOC;
using System;

namespace CoreWebSimple
{
    [AutoInject(InjectKind.Typed)]
    public interface Provider
    {
        string Write();
    }

    public class Provider1 : Provider
    {
        public string Write()
        {
            return "Im Provider 1";
        }
    }

    public interface Provider<T>
    {
        string Write(T data);
    }
    [AutoInject(InjectKind.Typed)]
    public class Provider2 : Provider<string>
    {
        public string Write(string data)
        {
            return data;
        }
    }
    [AutoInject(InjectKind.Typed)]
    public class Provider3<TModel, TKey> where TModel : class
    {
        public TModel Write(TModel data)
        {
            // Console.WriteLine(JsonConvert.SerializeObject(data));
            return data;
        }
    }

    public class Model
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }


    [AutoInject(Kind = InjectKind.Named)]
    public interface Named
    {
        void Exec();
    }

    [Inject(Named = "Named1")]
    public class Named1 : Named
    {
        public void Exec()
        {
            Console.WriteLine("Named1");
        }
    }
    [Inject(Named = "Named2")]
    public class Named2 : Named
    {
        public void Exec()
        {
            Console.WriteLine("Named2");
        }
    }
}
